from . import db

class Vm(db.Model):
    __tablename__ = 'vms'
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    ip = db.Column(db.String(64), nullable=False)
    ins_type = db.Column(db.String(64), nullable=False)
    region = db.Column(db.String(64), nullable=False)
    platform = db.Column(db.String(64), nullable=False)
    status = db.Column(db.String(64), nullable=False)
    owner = db.Column(db.String(64), nullable=False)

    def to_json(self):
        return {
            'id' : self.id,
            'ip' : self.ip,
            'ins_type' : self.ins_type,
            'region' : self.region,
            'platform' : self.platform,
            'status' : self.status,
            'owner' : self.owner
        }